local sk__zhouyan = fk.CreateSkill {

  name = "sk__zhouyan",

  tags = {},

}



sk__zhouyan:addEffect("active", {
  name = "sk__zhouyan",
  anim_type = "offensive",
  card_num = 0,
  target_num = 1,
  prompt = "#sk__zhouyan",
  can_use = function(self, player)
    return player:usedSkillTimes(sk__zhouyan.name, Player.HistoryPhase) == 0
  end,
  card_filter = Util.FalseFunc,
  target_filter = function(self, player, to_select, selected, selected_cards)
    return #selected == 0
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    target:drawCards(1, sk__zhouyan.name)
    if target.dead or not player:canUseTo(Fk:cloneCard("fire_attack"), target) then return end
    local use = room:useVirtualCard("fire_attack", nil, player, target, sk__zhouyan.name)
    if use and not player.dead and not target.dead and use.damageDealt and
        room:askForSkillInvoke(player, sk__zhouyan.name, nil, "#sk__zhouyan-invoke::" .. target.id) then
      player:broadcastSkillInvoke(sk__zhouyan.name)
      room:notifySkillInvoked(player, sk__zhouyan.name)
      room:doIndicate(player.id, { target.id })
      self:onUse(room, {
        from = player,
        tos = { target },
      })
    end
  end,
})

sk__zhouyan:addEffect(fk.Damage, {
  name = "#sk__zhouyan_trigger",
  mute = true,
  can_trigger = function(self, event, target, player, data)
    return target and target == player and player:hasSkill(sk__zhouyan.name) and data.damageType == fk.FireDamage
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    player:broadcastSkillInvoke("sk__zhouyan")
    player.room:notifySkillInvoked(player, "sk__zhouyan", "drawcard")
    player:drawCards(1, "sk__zhouyan")
  end,
})

return sk__zhouyan
